using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SkeleStunnedState : SkeleEnemyState
{
    public SkeleStunnedState(SkeleEnemy skele, StateMachine stateMachine, string animName) : base(skele, stateMachine, animName)
    {
    }

    public override void Enter()
    {
        base.Enter();
        skele.fx.InvokeRepeating("RedColorBlink", 0, .1f);
        stateTimer = skele.stunnedDuration;
        rb.velocity = new Vector2(-skele.facingDir* skele.stunnedDirection.x, skele.stunnedDirection.y);
    }

    public override void Exit()
    {
        base.Exit();
        skele.fx.Invoke("CancelRedBlink",0);
    }

    public override void Update()
    {
        base.Update();
        if(stateTimer<0)
            stateMachine.ChangeState(skele.idleState);
    }


}
